package com.codeforces;

import java.util.Scanner;

public class _158A {

	static int n, k, count, idx;
	static int[] score;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		k = scanner.nextInt();
		score = new int[n];
		count = 0;
		for (int i=0;i<n;++i) {
			score[i] = scanner.nextInt();
			if (score[i] >= score[k-1]) {
				if (score[i] > 0) {
					++count;
				}
			}
		}
		System.out.println(count);
	}

}
